package ro.gateway.aida.obj;

import java.util.Comparator;

/**
 * Created by IntelliJ IDEA.
 * User: Administrator
 * Date: Jul 15, 2004
 * Time: 4:00:59 PM
 * To change this template use File | Settings | File Templates.
 */
public class AIDAObjSector$Comparator implements Comparator {
	public int compare(Object o1, Object o2) {
		AIDAObjSector os1 = (AIDAObjSector) o1;
		AIDAObjSector os2 = (AIDAObjSector) o2;

		AIDASector s1 = os1.getSector();
		AIDASector s2 = os2.getSector();
		if (s1 == null || s2 == null) {
			return 0;
		}
		int rez = s1.getTitleAsString().compareTo(s2.getTitleAsString());
		if (rez != 0) return rez;

		s1 = os1.getSubsector();
		s2 = os2.getSubsector();
		if (s1 == null || s2 == null) {
			return 0;
		}
		rez = s1.getTitleAsString().compareTo(s2.getTitleAsString());
		if (rez != 0) return rez;

		s1 = os1.getSubsector1();
		s2 = os2.getSubsector1();
		if (s1 == null || s2 == null) {
			return 0;
		}
		rez = s1.getTitleAsString().compareTo(s2.getTitleAsString());
		if (rez != 0) return rez;

		return 0;
	}
}
